import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_base/model/routeModel.dart';
import 'package:flutter_base/routes/routes.dart';

class SecondPage extends StatefulWidget {
  RouteModel? mymodel;
  SecondPage({super.key, required this.mymodel});

  @override
  State<SecondPage> createState() => _SecondPageState();
}

class _SecondPageState extends State<SecondPage> {
  @override
  Widget build(BuildContext context) {
    // 获取上一个界面传递的参数
    var args = ModalRoute.of(context)?.settings.arguments;

    return Scaffold(
      appBar: AppBar(
        title: Text('$args'),
      ),
      body: Text('${widget.mymodel}'),
      floatingActionButton: FloatingActionButton(onPressed: () {
        Navigator.pushNamed(context, RoutePages.thirdPageRoute, arguments: {
          '22': 'wee',
          'data': [1, 2, 3, 4, 5]
        });
      }),
    );

    Placeholder(child: Text('this is second page, arguments : ${args}'));
  }
}
